$(function(){
	var imageuploader = document.getElementById('imageuploader');
	var previewer = document.getElementById('previewer');
	imageuploader.onchange = function() {
		var selectedFile = this.files[0];
		var reader = new FileReader();
		reader.onload = function() {
			previewer.src = reader.result;
		}
		reader.readAsDataURL(selectedFile);
	}
	
	$('#username').on('blur', function(event) {
		var $self = $(this)
		$.post('./check.do', {username: $self.val()}, function(data) {
			if(data.ok === 1) {
				$self.closest('.form-group').addClass('has-success has-feedback');
				$self.after('<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>')
			} else {
				$self.closest('.form-group').addClass('has-error has-feedback');
				$self.after('<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>')
			}
		})
	})
	$('#username').on('focus', function() {
		
	})
})